import axios from '@/utils/axios'

const addSpPackageApi = '/sp_admin/sp_package/add' // 新增
const updateSpPackageApi = '/sp_admin/sp_package/update' // 编辑
const spPackageDetailApi = '/sp_admin/sp_package/info' // 详情
const spPackageListApi = '/sp_admin/sp_package/list' // 套餐
const spPackagePageApi = '/sp_admin/sp_package/page' // 套餐
const spPackageFeaturesApi = '/sp_admin/sp_package/getPackageFeatures' // 权限
const delSpPackageApi = '/sp_admin/sp_package/delete' // 删除

/**
 * @desc 新增
 */
export const addSpPackage = ({ data }) => {
  return axios.post(addSpPackageApi, data)
}

/**
 * @desc 编辑
 */
export const updateSpPackage = ({ data }) => {
  return axios.post(updateSpPackageApi, data)
}

/**
 * @desc 详情
 */
export const spPackageDetail = ({ params }) => {
  return axios({
    url: spPackageDetailApi,
    method: 'get',
    params: params
  })
}

/**
 * @desc 列表
 */
export const spPackageList = () => {
  return axios.get(spPackageListApi)
}

/**
 * @desc 列表分页
 */
export const spPackagePage = ({ data }) => {
  return axios.post(spPackagePageApi, data)
}

/**
 * @desc 权限
 */
export const spPackageFeatures = () => {
  return axios.get(spPackageFeaturesApi)
}

/**
 * @desc 删除
 */
export const delSpPackage = ({ data }) => {
  return axios.post(delSpPackageApi, data)
}
